#line 1 "..\\SourceCode\\Target\\source\\target.c"











 














 





 

#line 1 "D:\\Keil\\ARM\\INC\\Philips\\LPC23xx.h"















 




 
#line 33 "D:\\Keil\\ARM\\INC\\Philips\\LPC23xx.h"

#line 66 "D:\\Keil\\ARM\\INC\\Philips\\LPC23xx.h"


 
#line 101 "D:\\Keil\\ARM\\INC\\Philips\\LPC23xx.h"

 
#line 135 "D:\\Keil\\ARM\\INC\\Philips\\LPC23xx.h"




 
#line 152 "D:\\Keil\\ARM\\INC\\Philips\\LPC23xx.h"

#line 163 "D:\\Keil\\ARM\\INC\\Philips\\LPC23xx.h"

 
#line 174 "D:\\Keil\\ARM\\INC\\Philips\\LPC23xx.h"

 

















 
#line 200 "D:\\Keil\\ARM\\INC\\Philips\\LPC23xx.h"

























 























































































































































































 


 




 





 



 






	
 





 


 


 



 



 










 





 
#line 487 "D:\\Keil\\ARM\\INC\\Philips\\LPC23xx.h"

#line 496 "D:\\Keil\\ARM\\INC\\Philips\\LPC23xx.h"

 
#line 505 "D:\\Keil\\ARM\\INC\\Philips\\LPC23xx.h"

#line 513 "D:\\Keil\\ARM\\INC\\Philips\\LPC23xx.h"

#line 521 "D:\\Keil\\ARM\\INC\\Philips\\LPC23xx.h"

#line 529 "D:\\Keil\\ARM\\INC\\Philips\\LPC23xx.h"



	
 
#line 552 "D:\\Keil\\ARM\\INC\\Philips\\LPC23xx.h"

 
#line 572 "D:\\Keil\\ARM\\INC\\Philips\\LPC23xx.h"

 
#line 592 "D:\\Keil\\ARM\\INC\\Philips\\LPC23xx.h"

 
#line 612 "D:\\Keil\\ARM\\INC\\Philips\\LPC23xx.h"


 
#line 638 "D:\\Keil\\ARM\\INC\\Philips\\LPC23xx.h"

#line 662 "D:\\Keil\\ARM\\INC\\Philips\\LPC23xx.h"


 
#line 680 "D:\\Keil\\ARM\\INC\\Philips\\LPC23xx.h"

 
#line 698 "D:\\Keil\\ARM\\INC\\Philips\\LPC23xx.h"

 
#line 715 "D:\\Keil\\ARM\\INC\\Philips\\LPC23xx.h"

 
#line 732 "D:\\Keil\\ARM\\INC\\Philips\\LPC23xx.h"

 
#line 742 "D:\\Keil\\ARM\\INC\\Philips\\LPC23xx.h"

 
#line 752 "D:\\Keil\\ARM\\INC\\Philips\\LPC23xx.h"

 
#line 762 "D:\\Keil\\ARM\\INC\\Philips\\LPC23xx.h"

 
#line 770 "D:\\Keil\\ARM\\INC\\Philips\\LPC23xx.h"

 
#line 783 "D:\\Keil\\ARM\\INC\\Philips\\LPC23xx.h"

 
#line 796 "D:\\Keil\\ARM\\INC\\Philips\\LPC23xx.h"


 
#line 827 "D:\\Keil\\ARM\\INC\\Philips\\LPC23xx.h"


 
#line 843 "D:\\Keil\\ARM\\INC\\Philips\\LPC23xx.h"


 




 
#line 857 "D:\\Keil\\ARM\\INC\\Philips\\LPC23xx.h"

 
#line 868 "D:\\Keil\\ARM\\INC\\Philips\\LPC23xx.h"






#line 887 "D:\\Keil\\ARM\\INC\\Philips\\LPC23xx.h"
  	
#line 900 "D:\\Keil\\ARM\\INC\\Philips\\LPC23xx.h"

#line 914 "D:\\Keil\\ARM\\INC\\Philips\\LPC23xx.h"
  	
#line 927 "D:\\Keil\\ARM\\INC\\Philips\\LPC23xx.h"


 
#line 950 "D:\\Keil\\ARM\\INC\\Philips\\LPC23xx.h"


 
#line 964 "D:\\Keil\\ARM\\INC\\Philips\\LPC23xx.h"


 
#line 982 "D:\\Keil\\ARM\\INC\\Philips\\LPC23xx.h"

 






 







 





 






 






 




 



 






 
#line 1053 "D:\\Keil\\ARM\\INC\\Philips\\LPC23xx.h"

 
 
#line 1080 "D:\\Keil\\ARM\\INC\\Philips\\LPC23xx.h"

 





  



#line 1098 "D:\\Keil\\ARM\\INC\\Philips\\LPC23xx.h"


 





  




 
#line 1127 "D:\\Keil\\ARM\\INC\\Philips\\LPC23xx.h"





#line 1144 "D:\\Keil\\ARM\\INC\\Philips\\LPC23xx.h"


























#line 36 "..\\SourceCode\\Target\\source\\target.c"
#line 1 "..\\SourceCode\\target\\include\\types.h"



typedef unsigned char  	U8;
typedef char  			S8;
typedef unsigned short 	U16;
typedef short 			S16;
typedef unsigned long  	U32;
typedef long  			S32;
typedef unsigned char  	BOOL;

typedef U32				BASE_TYPE;

typedef U32				SIZE_TYPE;













#line 37 "..\\SourceCode\\Target\\source\\target.c"





 









 






 






 






 






 

extern void PLL_Init(void);
static  void  MAM_Init         (void);





 








 













 

void  target_init (void)
{
    PLL_Init();                                    	             
    MAM_Init();                                               	 
}












 

U32  target_CPU_ClkFreq (void)
{
    U32  msel;
    U32  nsel;
    U32  fin;
    U32  pll_clk_feq;                                     
    U32  clk_div;
    U32  clk_freq;


    switch ((*(volatile unsigned long *)(0xE01FC000 + 0x10C)) & 0x03) {                                  
        case 0:
             fin = 4000000L;
             break;

        case 1:
             fin = 12000000L;
             break;

        case 2:
             fin = 32768L;
             break;

        default:
             fin = 4000000L;
             break;
    }

    if (((*(volatile unsigned long *)(0xE01FC000 + 0x088)) & (1 << 25)) > 0) {                                 
        msel        = (U32)((*(volatile unsigned long *)(0xE01FC000 + 0x088)) & 0x3FFF) + 1;            
        nsel        = (U32)(((*(volatile unsigned long *)(0xE01FC000 + 0x088)) >>   16) & 0x0F) + 1;    
        pll_clk_feq = (2 * msel * (fin / nsel));                     
    } else {
        pll_clk_feq = (fin);                                         
    }

    clk_div         = (U32)((*(volatile unsigned long *)(0xE01FC000 + 0x104)) & 0xFF) + 1;              
    clk_freq        = (U32)(pll_clk_feq / clk_div);           

    return (clk_freq);
}







 












































 






















































































 

static  void  MAM_Init (void)
{
    U32  clk_freq;


    clk_freq = target_CPU_ClkFreq();                                

    (*(volatile unsigned long *)(0xE01FC000 + 0x000))    = 0;                                                

    if (clk_freq < 20000000) {                                   
        (*(volatile unsigned long *)(0xE01FC000 + 0x004)) = 1;                                              
    }

    if (clk_freq < 40000000) {
        (*(volatile unsigned long *)(0xE01FC000 + 0x004)) = 2;                                              
    }

    if (clk_freq >= 40000000) {
        (*(volatile unsigned long *)(0xE01FC000 + 0x004)) = 3;                                              
    }

    (*(volatile unsigned long *)(0xE01FC000 + 0x000)) = 2;                                                   
}
